<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <base href="<%=basePath%>">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>Title</title>
    <script src="js/jquery-1.8.0.js"></script>
    <link rel="stylesheet" type="text/css" href="css/maintable.css" ></link>
    <script>
        $(function () {
            $("#but1").click(function () {
                window.location.href="RoleServlet?flag=listadmin&pageIndex=1";
            });
            $("#but2").click(function () {
                window.location.href="RoleServlet?flag=listadmin&pageIndex="+${page.pageIndex-1};
            });
            $("#but3").click(function () {
                window.location.href="RoleServlet?flag=listadmin&pageIndex="+${page.pageIndex+1};
            });
            $("#but4").click(function () {
                window.location.href="RoleServlet?flag=listadmin&pageIndex="+${page.pageCount };
            });
        });
    </script>

</head>
<body>
<div class ="div_title">
    <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>用户角色表</span></div></div>

<form action="xxx"  name="form1">
    <table class="main_table" >
        <tr>
           	<th>账号</th> 	<th>状态</th>	<th>用户角色</th>  <th>最后更新日期</th> 	<th>操作</th>
        </tr>
        <c:forEach var="c" items="${adminList}">
            <tr>
                <td>${c.adminName}</td>
                <td name="st">${c.getstatename()}</td>
                <td> <a>${c.roleName} </a> </td>
                <td><fmt:formatDate value="${c.editDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                <td>
                    <c:choose>
                        <c:when test="${c.getstatename()=='正常'}">
                            <a href="RoleServlet?flag=shouquan&id=${c.id}&roleName=${c.roleName}&pageIndex=${page.pageIndex}">角色授权</a>
                        </c:when>
                    </c:choose>
                </td>
            </tr>
        </c:forEach>
    </table>
</form>

<div class="div_page" >
    <div class="div_page_left">
        共有 <label>${page.rowCount }</label> 条记录，
        当前第 <label>${page.pageIndex}</label> 页，
        共 <label>${page.pageCount }</label> 页
    </div>
    <div class="div_page_right" >
        <c:choose>
            <c:when test="${page.hasPre }">
                <button id="but1">首页</button>
                <button id="but2"> 上一页</button>
            </c:when>
            <c:otherwise>
                首页
                上一页
            </c:otherwise>
        </c:choose>

        <c:choose>
            <c:when test="${page.hasNext }">
                <button id="but3">下一页 </button>
                <button id="but4">尾页</button>
            </c:when>
            <c:otherwise>
                下一页
                尾页
            </c:otherwise>
        </c:choose>
        <button id="but5">转到</button>
        <input type="text" name="pageIndex" id="pageIndex" value="1" /> 页

    </div>

</div>
</body>
</html>
